<?php

use Illuminate\Database\Schema\Blueprint;

class CreateModules extends \App\Utils\CreateMigration
{

    function columns(Blueprint $table)
    {
        $table->string('name', 50)->comment('名称');
        $table->string('tag', 100)->comment('标签');
        $table->string('url', 50)->nullable()->comment('URL');
        $table->unsignedInteger('pid')->default(0)->comment('父ID');
        $table->unsignedInteger('level')->default(1)->comment('层级');
        $table->integer('sort')->default(0)->comment('排序');
        $table->boolean('hide')->default(0)->comment('是否隐藏 1-是 0-否');
        $table->index(['deleted_at', 'pid'], 'index_deleted_role_tag');
        $table->index(['sort'], 'index_sort');
        $table->index(['hide'], 'index_hide');
    }

    function tableInfo()
    {
        return ['modules','权限模块'];
    }
}
